package com.study.manage.dal;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import com.study.manage.domain.EvaluateApplyWorkVote;
import com.study.manage.domain.enumm.LiveDieState;


public interface EvaluateApplyWorkVoteRepository
        extends PagingAndSortingRepository<EvaluateApplyWorkVote, Long>,
        JpaSpecificationExecutor<EvaluateApplyWorkVote> {

    @Query("select sum(t.voteNumber) from EvaluateApplyWorkVote t where t.blogId=:blogId and t.state=:state")
    Integer sumCountByBlogIdAndState(@Param("blogId") Long blogId,
            @Param("state") LiveDieState state);

    int countByEvaluateApplyIdAndState(Long evaluateApplyId, LiveDieState state);


}
